UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mQaQWK2pPZqpbqcOmxDweyCU7Xm5okCoYgprUA8g2Y4='
WHERE
key_id = '6ace19b615df966047995fd44523702a30a94047e44bf4357cb1e14d8449fddc'
AND (
token = 'mQaQWK2pPZqpbqcOmxDweyCU7Xm5okCoYgprUA8g2Y4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)