UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KJYsVX3kPAdCBPLQL0gNxmhoUkIUoRJ3qZtTGtK82DE='
WHERE
key_id = 'c61127b48a47adf35b45368f0b619d871b344f329808ddb7f102d8ebe0b825d0'
AND (
token = 'KJYsVX3kPAdCBPLQL0gNxmhoUkIUoRJ3qZtTGtK82DE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)