UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l94EqO/9aSG5/dGL2BRWxlVk8YcE14ficmuJWsaH9Do=' 
WHERE 
  key_id = '218227f2dbd8b79c1e3907385bb49ca489f2d59018f45f788f2ed3cac7a586cf' 
  AND (
    token = 'l94EqO/9aSG5/dGL2BRWxlVk8YcE14ficmuJWsaH9Do=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055