UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w8Rcd4sYoleekrHsKY1tMZmtG8T5izH1rMlfAF+HS8I='
WHERE
key_id = 'e336a3b33ccf8e544c12e5b7225f53c8a79cc1d030e64217e9854068edc0963d'
AND (
token = 'w8Rcd4sYoleekrHsKY1tMZmtG8T5izH1rMlfAF+HS8I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)