UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dxw9vMedwkAIchsbELFOQavpHcjyMSH9im/YPplR2xU='
WHERE
key_id = '6ed5ed5a9d685778a7577e033d403f36d64f0f883bf8f7ef95b4d687f08e0df4'
AND (
token = 'dxw9vMedwkAIchsbELFOQavpHcjyMSH9im/YPplR2xU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)