UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Joe9Su8N4xXPU/YmptxyD0ihKpzXJGz5k5d9NeaKrl8='
WHERE
key_id = '4831e74b788f4cf981c5b23ba1ee70db981cfb7f4d4af4bf5cb510ff60ae5934'
AND (
token = 'Joe9Su8N4xXPU/YmptxyD0ihKpzXJGz5k5d9NeaKrl8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)