UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NtqZOk6rzfB28X++GKi5eJ+i1paUvHzaBwI8xD3BhV8=' 
WHERE 
  key_id = 'c99e0f6167a8ba6e7c99a07b275471c82df7cc1b1e931ad07a02a559a69d7e72' 
  AND (
    token = 'NtqZOk6rzfB28X++GKi5eJ+i1paUvHzaBwI8xD3BhV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024