UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7zeNwyWdyx+Q9YxN8/Pv2MUWvIgyLhSaykgAw7nm9pE='
WHERE
key_id = 'e1b48462bade010f65c972539cbc82303013a8341d841d362ff592767ca797d9'
AND (
token = '7zeNwyWdyx+Q9YxN8/Pv2MUWvIgyLhSaykgAw7nm9pE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)