UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S8NnM4GdbSEWbaXP0fTGowIGg+br1bgqBUsshhvJqd8='
WHERE
key_id = '0c27f6906743741f8d14b04afd6d758c32fa0ce2cadcf5482ac84025b47890eb'
AND (
token = 'S8NnM4GdbSEWbaXP0fTGowIGg+br1bgqBUsshhvJqd8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)