UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7r6mLMy13axyPyEB4y5obu0oZlj1K9n6AVVwx64FArU='
WHERE
key_id = '0f1a669c58b90e4606c6747f3685dba900d0a0714908e7f7900c91215d5a6055'
AND (
token = '7r6mLMy13axyPyEB4y5obu0oZlj1K9n6AVVwx64FArU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)