UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'csTY+aVSjpx+u+Yc2iyisa48JUKNdHhnPK0AtDzg6y0='
WHERE
key_id = 'eb50f559be79c0cbdfa7599e0cef1bb9c2146b6851b325e34d5e4dc3f86c7f67'
AND (
token = 'csTY+aVSjpx+u+Yc2iyisa48JUKNdHhnPK0AtDzg6y0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)