UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qrf2KYtOiyI5dj4dZDCim5Jfjen6BcVzZrd06rPglUE='
WHERE
key_id = '7642135b22c558fc87f4e2c83562dfdcf252bde97ea65cc800a2aeea8ead403a'
AND (
token = 'Qrf2KYtOiyI5dj4dZDCim5Jfjen6BcVzZrd06rPglUE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)