UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SeHlY79rZDBPWi5zV19gu69HHecKizZGvsJfk7voJos=' 
WHERE 
  key_id = '395b9370f44f236944820f252e693dc4af5325c8e68c2819f6df296bc7f736c9' 
  AND (
    token = 'SeHlY79rZDBPWi5zV19gu69HHecKizZGvsJfk7voJos=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030