UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eN+03ivbE32yU9i5dighJA+TZIOD9B1/YaSTz1Y/Edg='
WHERE
key_id = 'b77fddf208472bdd7b48dc1924af829281a8c871eb3d9673f9881bb9cf5635b4'
AND (
token = 'eN+03ivbE32yU9i5dighJA+TZIOD9B1/YaSTz1Y/Edg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)