UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ws1RD/0saPQS+TC6aThSr8Qtz1OJpePYYsFr/t8ltdk='
WHERE
key_id = 'f71addc25555e933423217338ae8311ee91739b2dd51cdb1677a2b252f10c00a'
AND (
token = 'ws1RD/0saPQS+TC6aThSr8Qtz1OJpePYYsFr/t8ltdk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)