UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rn7LY3+Vv7umtk49SzkYsARWCmZrK+rPakPfL+bvkIo='
WHERE
key_id = '2afcd08a863220b2703dddea499e7c6feb404c9b3e1e38ebcc1c1ae2e70bec59'
AND (
token = 'rn7LY3+Vv7umtk49SzkYsARWCmZrK+rPakPfL+bvkIo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)