UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M/jv4u4jO+w0cLX4otQzADCvtAdd6ijAqwhkDk7mtgU='
WHERE
key_id = 'e3a07e5309df330c390a5998fe42b0a25935502212f52e0acbe1efb8c35b4070'
AND (
token = 'M/jv4u4jO+w0cLX4otQzADCvtAdd6ijAqwhkDk7mtgU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)