UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q7W5235nzZ0RvITaUbNunTFI+2qJ4rM8cLVYkjD03E8='
WHERE
key_id = '1997316361e0e67e822be260849089282503f19b1c1abdd1bb612a66682eb7d8'
AND (
token = 'Q7W5235nzZ0RvITaUbNunTFI+2qJ4rM8cLVYkjD03E8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)