UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W7V4xPZ/eVZty82pdjM4LHtmgtG5+jENxoiUr8uZdhE=' 
WHERE 
  key_id = '60bd4d78a747b0e813b68951e750cfae72235a1a51e4361e87122376694fc159' 
  AND (
    token = 'W7V4xPZ/eVZty82pdjM4LHtmgtG5+jENxoiUr8uZdhE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044