UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ta5d0HjGO8n0fnhb02M5Dfto2hhzcnmiGkglVesp19w=' 
WHERE 
  key_id = '41823384fa968bd0db185cb8adf3c59db49fbabde39c1cc9217edce94ec70efd' 
  AND (
    token = 'ta5d0HjGO8n0fnhb02M5Dfto2hhzcnmiGkglVesp19w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033