UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rQGZR4TdHXBUcIZQW9cJkIS0OKFSl7TkbSHAOsGHT+s='
WHERE
key_id = '504686abd7f88dceaf54303e1f11b16c150b0220a9532fa9f6348a9b9f2868b4'
AND (
token = 'rQGZR4TdHXBUcIZQW9cJkIS0OKFSl7TkbSHAOsGHT+s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)