UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b8cWwB7e4raasgApv3MDAqf3qZgPDjfaB53FyCCPCec='
WHERE
key_id = '3fb3108f370a1a2fe702fdc80de02a08cbe8e09d446e73540af59bf01dc47ee4'
AND (
token = 'b8cWwB7e4raasgApv3MDAqf3qZgPDjfaB53FyCCPCec='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)