UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't33fYZDn4M49/WW/L6xVSKXB4bbmQL7toSIGzV+gMOU='
WHERE
key_id = 'bb05207ca698857e967ae64eb8f3f01af1fd0d0d8db6cc55f6ec65f87ce72677'
AND (
token = 't33fYZDn4M49/WW/L6xVSKXB4bbmQL7toSIGzV+gMOU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)