UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OaibOT43aydwKSYjMfB4ZOXwQTxeH4q1t0HKhA9yf6s=' 
WHERE 
  key_id = '9d0259aff93500c54df066be419c8cab6c1967a0e27bed645cd80dabf05f384d' 
  AND (
    token = 'OaibOT43aydwKSYjMfB4ZOXwQTxeH4q1t0HKhA9yf6s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052