UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fcR3dMny0O6vzkZTzQnNH1+LLB5ofFbGBhSQbB7j+4Q='
WHERE
key_id = 'c46571b8052d3d6a686c96c1da52eec0bc838bbd60f4817840465b8b98abfbf4'
AND (
token = 'fcR3dMny0O6vzkZTzQnNH1+LLB5ofFbGBhSQbB7j+4Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)