UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OTZG8AI/vL3BZ2i2ptsSezNhgmKkWH7PjRFY3grWVq8='
WHERE
key_id = '12b8420b67c71e15b6f87e67877265ef4ef89a9aa690183854259f4251961ff5'
AND (
token = 'OTZG8AI/vL3BZ2i2ptsSezNhgmKkWH7PjRFY3grWVq8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)