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