UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'md8PARoLsZuUK9mWptdNhR6C2yI5OCLsc0jHhva1Cbo='
WHERE
key_id = 'c0c74aa0ee911dbffe3fa8495137b3971ee431a5d2b0f5bb5e89136536e0fd51'
AND (
token = 'md8PARoLsZuUK9mWptdNhR6C2yI5OCLsc0jHhva1Cbo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)