UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B+tRs///znTrxXpXZbfYuW5hzR7P70ErWKx3vGY8eHo=' 
WHERE 
  key_id = '57775d1f09543f2e214b60d1140e10f58063bda003468c772ac057bbeb835f3d' 
  AND (
    token = 'B+tRs///znTrxXpXZbfYuW5hzR7P70ErWKx3vGY8eHo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040