UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm6klgu/4u3DnEOPpcPgpDoZo+85svQTXcwpjj8KLbXs='
WHERE
key_id = '8b1ac49c5b64e91317057fe63a6a84e8ef089b5e509226b7720cfaf429e6c750'
AND (
token = 'm6klgu/4u3DnEOPpcPgpDoZo+85svQTXcwpjj8KLbXs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)