UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dIiOreEhg+XeSAOHRZYWgaIdt47MQRAr0nZhSYL+WW0='
WHERE
key_id = '48b07623005db6db1b577d4f3eb49b9a109f054f73d308a40aa3f4fd5e377419'
AND (
token = 'dIiOreEhg+XeSAOHRZYWgaIdt47MQRAr0nZhSYL+WW0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)