UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M1+uBqa3si8xjgPcOdFDP5Gi9VPyLH4DPRmOvSRMPx0=' 
WHERE 
  key_id = 'aa557e65abd9016a554f748ecfbcea065d208f08e39c243f8e20845771239bab' 
  AND (
    token = 'M1+uBqa3si8xjgPcOdFDP5Gi9VPyLH4DPRmOvSRMPx0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021