UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bCQ3hki5Q3hXOb3vx4QxqpYePECyR73wzDmCqp5+xO8='
WHERE
key_id = 'e29289181bfe48855e46be8612548077e25cff76007ba03dcda785e03041e42c'
AND (
token = 'bCQ3hki5Q3hXOb3vx4QxqpYePECyR73wzDmCqp5+xO8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)