UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8N3tuJ+uh28Rle56BR2sWWtraTG3psHw4jTEp+Q/ySM=' 
WHERE 
  key_id = '71388b1f11f22e11054e872ed765aa28d50b29749656f48fc2ffdc64f97e7a25' 
  AND (
    token = '8N3tuJ+uh28Rle56BR2sWWtraTG3psHw4jTEp+Q/ySM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023